﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Routing;
using System.Web.Mvc;

namespace Web.Helper
{
    public static class MyrouteValues
    {
        public static RouteValueDictionary Get()
        {
            RouteValueDictionary vs = new RouteValueDictionary();

            var queryString = HttpContext.Current.Request.QueryString;
            foreach (string key in queryString.Keys)
                vs[key] = queryString[key];

            //var FormString = HttpContext.Current.Request.Form;
            //foreach (string key in FormString.Keys)
            //    vs[key] = FormString[key];

            vs.Remove("X-Requested-With");
            vs.Remove("X-HTTP-Method-Override");

            return vs;
        }

        public static RouteValueDictionary Get(string valuekey, string value)
        {
            RouteValueDictionary vs = new RouteValueDictionary();

            var queryString = HttpContext.Current.Request.QueryString;
            foreach (string key in queryString.Keys)
                vs[key] = queryString[key];

            //var FormString = HttpContext.Current.Request.Form;
            //foreach (string key in FormString.Keys)
            //    vs[key] = FormString[key];


            vs[valuekey] = value;

            vs.Remove("X-Requested-With");
            vs.Remove("X-HTTP-Method-Override");

            return vs;
        }
    }
}